Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to specify a stroke type, Center/Inner/Outter #703

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ryuukk
Copy link
Contributor

@ryuukk ryuukk commented Sep 25, 2024

info: this PR message will be updated since the PR has changed

When window's padding is set to 0, you can see that widget's borders get clipped

I'm still not sure if that is the right solution, but it works for me

In case this is not an accepted PR, it'll provide a solution for those affected by this problem

Before:

image

After:

image

@ryuukk
Copy link
Contributor Author

ryuukk commented Sep 25, 2024

Looks like it is not the right fix, or perhaps incomplete

When using with rounding the background is visible, so perhaps the fix should be applied on a per widget basis

image

@ryuukk
Copy link
Contributor Author

ryuukk commented Sep 25, 2024

I have a better idea, let's have 3 functions instead, and call the proper one

image

@ryuukk
Copy link
Contributor Author

ryuukk commented Sep 25, 2024

Looks good now

image

@ryuukk ryuukk changed the title Make it so borders don't get clipped Add a way to specify a stroke type, Center/Inner/Outter Sep 25, 2024
@RobLoach
Copy link
Contributor

Looking great! Still clipped on the left when anti-aliasing is off. I find the - 0.5f on there questionable too, but that may be the center stroke strategy you mentioned. Perhaps we need to roundf() it?

https://github.com/Immediate-Mode-UI/Nuklear/blob/master/src/nuklear_vertex.c#L965

if (list->line_AA == NK_ANTI_ALIASING_ON) {
    nk_draw_list_path_rect_to(list, nk_vec2(rect.x, rect.y),
        nk_vec2(rect.x + rect.w, rect.y + rect.h), rounding);
} else {
    nk_draw_list_path_rect_to(list, nk_vec2(rect.x-0.5f, rect.y-0.5f),
        nk_vec2(rect.x + rect.w, rect.y + rect.h), rounding);
} nk_draw_list_path_fill(list,  col);

@ryuukk ryuukk marked this pull request as draft September 25, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants